home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 443_01 / doc / info / cncl.info-1 < prev    next >
Encoding:
GNU Info File  |  1996-01-04  |  48.7 KB  |  1,678 lines

  1. This is Info file cncl.info, produced by Makeinfo-1.63 from the input
  2. file cncl.texi.
  3.  
  4.    This file documents the use of CNCL, the Communication Networks Class
  5. Library.
  6.  
  7.    Copyright (C) 1993-1996, Communication Networks.
  8.  
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that the
  15. entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17.  
  18.    Permission is granted to copy and distribute translations of this
  19. manual into other languages, under the above conditions for modified
  20. versions.
  21.  
  22. 
  23. File: cncl.info,  Node: Top,  Next: Introduction,  Up: (DIR)
  24.  
  25. Introduction
  26. ************
  27.  
  28.    This manual documents how to use the CNCL 1.4 classes in your
  29. programs
  30.  
  31. * Menu:
  32.  
  33. * Introduction::    Introduction to the CNCL
  34. * Basic Classes::    The Basic Classes of the CNCL Hierarchy
  35. * Random Numbers::    Random Number Generators and Distributions
  36. * Evaluation::          Statistical Evaluation in CNCL
  37. * Container::        Container Classes
  38. * Events::        Event Driven Simulation
  39. * Arrays::        Arrays Classes
  40. * Object Management::   Object Management
  41. * Unix::        Unix Classes
  42. * Misc::        Miscellaneous Classes
  43. * EZD Interface::       EZD Interface Classes
  44. * Fuzzy::        Fuzzy Logic Classes
  45. * Persistent::        Persistent Classes
  46.  
  47. * Concept Index::    Index of Concepts
  48. * Function Index::    Index of Functions
  49.  
  50. 
  51. File: cncl.info,  Node: Introduction,  Next: Basic Classes,  Prev: Top,  Up: Top
  52.  
  53. Introduction to the CNCL
  54. ************************
  55.  
  56.    CNCL is a C++ library created at Communication Networks, Aachen
  57. University of Technology, Germany.
  58.  
  59.    The main objective of this class library is to provide a common base
  60. for all C++ applications created at Communication Networks. Therefore,
  61. CNCL is both a class library featuring generic C++ classes as well as a
  62. simulation library with strong points in random number generation,
  63. statistics, and event driven simulation.
  64.  
  65.    All globally visible classes and type definitions feature a "`CN'"
  66. prepended to their name to avoid collision with other class libraries,
  67. e.g. GNU libg++.
  68.  
  69. * Menu:
  70.  
  71. * Class Hierarchy::    CNCL Class Hierarchy
  72. * Common Functions::    Common CNCL Member Functions
  73. * CNgenclass::            CNgenclass Script to Generate Class Templates
  74. * minmax::            min(), max() functions header file
  75.  
  76. 
  77. File: cncl.info,  Node: Class Hierarchy,  Next: Common Functions,  Up: Introduction
  78.  
  79. CNCL Class Hierarchy
  80. ====================
  81.  
  82.      CNCL                       CNCL Static Members and Functions
  83.        CNObject                 Root of the CNCL Hierarchy
  84.          CNClass                Class Description
  85.          CNParam                Abstract Parameter Base Class
  86.      
  87.          CNRNG                  Abstract Random Number Generator Base Class
  88.            CNACG                Additive RNG
  89.            CNFiboG              Fibonacci RNG
  90.            CNFileG              Data File RNG
  91.            CNLCG                Linear Congruence RNG
  92.            CNMLCG               Multiple Linear Congruence RNG
  93.            CNTausG              Tausworth RNG
  94.          CNRndInt               Random Integers
  95.          CNRandom               Abstract Random Distribution Base Class
  96.            CNBeta               Beta Distribution
  97.            CNBinomial           Binomial Distribution
  98.            CNDeterm             Deterministic Distribution
  99.            CNDiracTab           Distribution from Table
  100.            CNDiscUniform        Discrete Uniform Distribution
  101.            CNErlang             Erlang-k Distribution
  102.            CNGeometric          Geometric Distributed Random Numbers
  103.            CNHyperExp           HyperExp Distributed Random Numbers
  104.            CNHyperGeom          HyperGeom Distributed Random Numbers
  105.            CNMDeterm            Random Mix of Deterministic Distributions
  106.            CNNegExp             Negative Exponential Distribution
  107.            CNNormal             Normal Distribution
  108.              CNLogNormal        LogNormal Distribution
  109.              CNRayleigh         Rayleigh Distribution
  110.              CNRice             Rice Distribution
  111.            CNPoisson            Poisson Distribution
  112.            CNRandomMix          Mix of Several `CNRandom' Distributions
  113.            CNTab                Distribution from Table
  114.              CNInterTab         Distribution from Table (Interpolated Values)
  115.            CNUniform            Uniform Distribution
  116.            CNWeibull            Weibull Distribution
  117.      
  118.          CNStatistics           Abstract Statistics Evaluation Base Class
  119.            CNMoments            Evaluation of (Weighted) Moments
  120.            CNMomentsTime        Evaluation of Time-Weighted Moments
  121.            CNLRE                LRE Base Class
  122.              CNLREF             Evaluation by LRE F(x)
  123.              CNLREG             Evaluation by LRE G(x)
  124.            CNDLREF              Evaluation by Discrete LRE F(x)
  125.            CNDLREG              Evaluation by Discrete LRE G(x)
  126.            CNBatchMeans         Evaluation by Batch Means
  127.      
  128.          CNAVLTree              AVL balanced binary search tree
  129.          CNAVLNode              Node of AVL tree
  130.          CNSLList               Single Linked List of Objects
  131.            CNDLList             Doubly Linked List of Objects
  132.          CNSLObject             Node of Single Linked List
  133.            CNDLObject           Node of DoubleyLinked List
  134.          CNSLIterator           Iterator of Single Linked List
  135.            CNDLIterator         Iterator of Doubly Linked List
  136.          CNStack                Stack
  137.          CNQueue                Abstract Queue Base Class
  138.            CNQueueFIFO          FIFO Queue
  139.            CNQueueLIFO          LIFO Queue
  140.            CNQueueRandom        Random Queue
  141.            CNQueueSPT           SPT Queue
  142.            CNPrioQueueFIFO      Priority Queue
  143.            CNSink               Sink
  144.          CNJob                  Standard Job for Queues
  145.      
  146.          CNDLObject
  147.            CNEvent              Generic Event
  148.          CNNamed
  149.            CNEventHandler       Abstract Base Class for Event Handlers
  150.              CNEventExploder    Send Events to multiple EventHandlers
  151.          CNEventList            List of Events
  152.          CNEventBaseSched
  153.            CNEventScheduler     Event Scheduler
  154.            CNEventHeapSched     Event Scheduler using a heap
  155.          CNSimTime              Simulation Time
  156.      
  157.          CNArray                Abstract Array Base Class
  158.            CNArrayObject        Array of Pointer to CNObject
  159.            CNArrayChar          Array of Char
  160.            CNArrayDouble        Array of Double
  161.            CNArrayFloat         Array of Float
  162.            CNArrayInt           Array of Int
  163.            CNArrayLong          Array of Long
  164.          CNArray2               Base class for 2-dimensional arrays
  165.            CNArray2Char         Char array class
  166.            CNArray2Double       double array class
  167.            CNArray2Float        float array class
  168.            CNArray2Int          int array class
  169.            CNArray2Long         long array class
  170.            CNArray2Object       CNObjPtr array class
  171.      
  172.          CNKey                  Abstract Base Class for Keys
  173.            CNKeyString          String Key
  174.            CNKeyInt             Integer Key
  175.          CNHashTable            Abstract Hash Table Base Class
  176.            CNHashStatic         Hash Tables with Static Capacity
  177.            CNHashDynamic        Hash Tables with Dynamic Capacity
  178.          CNHashIterator         Sequential Iterator for Hash Tables
  179.          CNManager              Object Management Frontend
  180.      
  181.          CNCoord                2-Dimensional Coordinates
  182.          CNICoord               2-Dimensional Integer Coordinates
  183.          CNString               Character String
  184.            CNFormInt            Integer as CNStrings
  185.            CNFormFloat          Doubles as CNStrings
  186.          CNNamed                Object with Name
  187.            CNIniFile            .ini-style config file
  188.          CNInt                  Integer derived from CNObject
  189.          CNDouble               Double derived from CNObject
  190.          CNGetOpt               Interface to GNU getopt()
  191.      CNRef                      Base class for classes with reference counting
  192.            CNObject
  193.              CNRefObj           CNObject with reference counting
  194.            CNNamed
  195.              CNRefNamed         CNNamed with reference counting
  196.          CNPtr                  Intelligent pointer to CNRefObjs
  197.      
  198.          CNPipe                 UNIX Pipe
  199.          CNSelect               UNIX Select Interface
  200.      
  201.          CNNamed
  202.            EZD                  Base Class for EZD Graphic Objects
  203.              EZDDrawing         Interface to EZD Drawings
  204.              EZDPushButton      Interface to EZD Push-Button
  205.              EZDWindow          Interface to EZD Windows
  206.              EZDDiagWin         Extra window with x-y diagram
  207.              EZDTextWin         EZD window for easy text display
  208.              EZDObject          Interface to EZD Object
  209.                EZDDiag          x-y diagram as an EZDObject
  210.                EZDBlock         Block with small rectangles for bit display
  211.                EZDPopUp         Interface to EZD popup menu
  212.                EZDQueue         Graphical Representation of a Queue
  213.                EZDServer        Graphical Representation of a Server
  214.                EZDText          EZD Object with Text
  215.                EZDTimer         Graphical Representation of a Timer
  216.      
  217.          CNFClause              Clause of a fuzzy rule
  218.          CNFRule                Fuzzy rule
  219.          CNNamed
  220.            CNFVar               Fuzzy variable
  221.            CNFRuleBase          Rule base and fuzzy inference engine
  222.            CNFSet               Fuzzy set abstract base class
  223.              CNFSetArray        Fuzzy set based on array with membership values
  224.              CNFSetLR           Fuzzy set with L and R functions
  225.               CNFSetTrapez      Fuzzy set with trapezium function
  226.                CNFSetTriangle   Fuzzy set with triangle function
  227.                 CNFNumTriangle  Fuzzy numbers (triangle) 
  228.      
  229.        CNReaderTbl              Table for adress of reader-function
  230.        CNPIO                    persistent stream Object IO-formatting
  231.        CNObject
  232.          CNPstream              abstract base class for persistent stream class
  233.            CNPiostream          persistent iostream format
  234.      CNPObjectID                ID-Managment for persistent classes
  235.              CNPInt             class persistent CNInt
  236.              CNP<type>          Other persistent classes
  237.  
  238. * Menu:
  239.  
  240. Basic classes:
  241.  
  242. * CNCL::        CNCL Static Members and Functions
  243. * CNObject::        Root of the CNCL Hierarchy
  244. * CNClass::        Class Description
  245. * CNParam::        Abstract Class for Constructor Parameter Objects
  246.  
  247. Random Number Generators:
  248.  
  249. * CNRNG::               Abstract Random Number Generator Base Class
  250. * CNACG::               Additive RNG
  251. * CNFiboG::             Fibonacci RNG
  252. * CNFileG::             Data File RNG
  253. * CNLCG::               Linear Congruence RNG
  254. * CNMLCG::              Multiple Linear Congruence RNG
  255. * CNTausG::             Tausworth RNG
  256.  
  257. Random Number Distributions:
  258.  
  259. * CNRndInt::        Random Integers
  260.  
  261. * CNRandom::            Abstract Random Distribution Base Class
  262. * CNBeta::              Beta Distribution
  263. * CNBinomial::          Binomial Distribution
  264. * CNDeterm::        Deterministic Distribution
  265. * CNDiracTab::          Distribution from Table
  266. * CNDiscUniform::       Discrete Uniform Distribution
  267. * CNErlang::            Erlang-k Distribution
  268. * CNGeometric::         Geometric Distributed Random Numbers
  269. * CNHyperExp::          HyperExp Distributed Random Numbers
  270. * CNHyperGeom::         HyperGeom Distributed Random Numbers
  271. * CNInterTab::          Distribution from Table (Interpolated Values)
  272. * CNLogNormal::         LogNormal Distribution
  273. * CNMDeterm::           Random Mix of Deterministic Distributions
  274. * CNNegExp::            Negative Exponential Distribution
  275. * CNNormal::            Normal Distribution
  276. * CNPoisson::           Poisson Distribution
  277. * CNRandomMix::         Mix of Several `CNRandom' Distributions
  278. * CNRayleigh::          Rayleigh Distribution
  279. * CNRice::              Rice Distribution
  280. * CNTab::               Distribution from Table
  281. * CNUniform::           Uniform Distribution
  282. * CNWeibull::           Weibull Distribution
  283.  
  284. Statistics:
  285.  
  286. * CNStatistics::    Abstract Statistics Base Class
  287. * CNMoments::        Evaluation of (Weighted) Moments
  288. * CNMomentsTime::    Evaluation of Time-Weighted Moments
  289. * CNLRE::               Evaluation by LRE
  290. * CNDLRE::              Evaluation by discrete LRE
  291. * CNBatchMeans::        Evaluation by Batch Means
  292.  
  293. Containers:
  294.  
  295. * CNAVLTree::           AVL balanced binary search tree
  296. * CNAVLNode::           Node of AVL tree
  297. * CNSLList::        Single Linked List of Objects
  298. * CNSLObject::        Node of Single Linked List
  299. * CNSLIterator::    Iterator of Single Linked List
  300. * CNDLList::        Doubly Linked List of Objects
  301. * CNDLObject::        Node of Doubly Linked List
  302. * CNDLIterator::    Iterator of Doubly Linked List
  303. * CNQueue::        Abstract Queue Base Class
  304. * CNQueueFIFO::        FIFO Queue
  305. * CNQueueLIFO::        LIFO Queue
  306. * CNQueueRandom::    Random Queue
  307. * CNQueueSPT::        SPT Queue
  308. * CNPrioQueueFIFO::    Priority Queue
  309. * CNJob::        Standard Job for Queues
  310. * CNSink::        Sink
  311. * CNStack::        Stack
  312.  
  313. Events:
  314.  
  315. * CNEvent::        Generic Event
  316. * CNEventExploder::     Send Events to multiple EventHandlers
  317. * CNEventHandler::    Abstract Base Class for Event Handlers
  318. * CNEventList::        List of Events
  319. * CNEventBaseSched::    Abstract scheduler base class
  320. * CNEventScheduler::    Event Scheduler
  321. * CNEventHeapSched::    Event Scheduler using a heap
  322. * CNSimTime::        Simulation Time
  323. * Event Example::    Example for Event Driven Simulation
  324.  
  325. Arrays:
  326.  
  327. * CNArray::        Abstract Array Base Class
  328. * CNArrayObject::    Array of Pointer to CNObject
  329. * CNArrayInt::        Array of Int
  330. * Other CNArray<type>::    Arrays of Other <Type>s
  331. * CNArray2::            Base class for 2-dimensional arrays
  332. * CNArray2Char::        Char array class
  333. * Other CNArray2<type>::Other <Type>s array class
  334.  
  335. Hash Tables and Object Management:
  336.  
  337. * CNKey::            Abstract Base Class for Object Management via Keys
  338. * CNKeyString::         Object Management via String Keys
  339. * CNKeyInt::        Object Management via Integer Keys
  340. * CNHashTable::        Abstract Hash Table Class
  341. * CNHashStatic::    Hash Tables with Static Capacity
  342. * CNHashDynamic::    Hash Tables with Dynamic Capacity
  343. * CNHashIterator::      Sequential Iterator for Hash Tables
  344. * CNManager::            Object Management Frontend
  345.  
  346. Miscellaneous:
  347.  
  348. * CNCoord::        2-Dimensional Coordinates
  349. * CNICoord::        2-Dimensional Integer Coordinates
  350. * CNString::        Character String
  351. * CNNamed::             CNObject with Name
  352. * CNIniFile::           .ini-style config file
  353. * CNFormInt::            Integer as CNStrings
  354. * CNFormFloat::            Doubles as CNStrings
  355. * CNInt::        Integer derived from CNObject
  356. * CNDouble::        Double derived from CNObject
  357. * CNGetOpt::            Interface to GNU getopt()
  358.  
  359. Unix:
  360.  
  361. * CNPipe::         Unix Pipe
  362. * CNSelect::            Class interface to select(2) system call
  363.  
  364. EZD:
  365.  
  366. * EZD::                 Base Class for EZD Graphic Objects
  367. * EZDObject::           Interface to EZD Object
  368. * EZDDrawing::          Interface to EZD Drawings
  369. * EZDPushButton::       Interface to EZD Push-Button
  370. * EZDWindow::           Interface to EZD Windows
  371. * EZDDiagWin::          Extra window with x-y diagram
  372. * EZDTextWin::          EZD window for easy text display
  373. * EZDDiag::             x-y diagram as an EZDObject
  374. * EZDBlock::            Block with small rectangles for bit display
  375. * EZDPopUp::            Interface to EZD popup menu
  376. * EZDQueue::            Graphical Representation of a Queue
  377. * EZDServer::           Graphical Representation of a Server
  378. * EZDText::             EZD Object with Text
  379. * EZDTimer::            Graphical Representation of a Timer
  380.  
  381. Fuzzy Logic:
  382.  
  383. * CNFClause::        Clause of a fuzzy rule
  384. * CNFVar::        Fuzzy variable
  385. * CNFRule::        Fuzzy rule
  386. * CNFRuleBase::        Rule base and Fuzzy inference engine
  387. * CNFSet::        Fuzzy set abstract base class
  388. * CNFSetArray::        Fuzzy set based on array with membership values
  389. * CNFSetLR::        Fuzzy set with L and R functions
  390. * CNFSetTrapez::    Fuzzy set with trapezium function
  391. * CNFSetTriangle::    Fuzzy set with triangle function
  392. * CNFNumTriangle::      Fuzzy numbers (triangle)
  393.  
  394. Persistent:
  395.  
  396. * CNReaderTbl::         Table for adress of reader-function
  397. * CNPObjectID::         ID-Managment for persistent Objects
  398. * CNPIO::        persistent stream Object IO-formatting
  399. * CNPstream::           abstract base class for persistent stream classes
  400. * CNPiostream::         persistent iostream format
  401. * CNPInt::              class persistent CNInt
  402. * Other CNP<type>::     Other persistent classes
  403.  
  404. 
  405. File: cncl.info,  Node: Common Functions,  Next: CNgenclass,  Prev: Class Hierarchy,  Up: Introduction
  406.  
  407. Common CNCL Member Functions
  408. ============================
  409.  
  410.    CNCL requires that all classes have a common set of member functions
  411. available. These functions provide runtime type checking and type
  412. information, creation of objects via class descriptions, and safe type
  413. casts.
  414.  
  415. The common member functions are:
  416.  
  417. `CNClassDesc CLASS::class_desc() const;'
  418.      This function returns a pointer to the class description object,
  419.      which must be available for every class in the CNCL hierarchy.
  420.      This pointer is used for runtime type information.
  421.  
  422. `bool CLASS::is_a(CNClassDesc desc) const;'
  423.      This function allows runtime type checking. It returns `TRUE' if
  424.      the queried object is type compatible with class `desc'.
  425.  
  426. `void CLASS::print(ostream &strm = cout) const;'
  427. `void CLASS::dump(ostream &strm = cout) const;'
  428.      These functions output the object to the given stream `strm'.  The
  429.      function `print()' is defined in greater detail in the derived
  430.      classes. The function `dump()' is intended for debug purposes.
  431.  
  432.    The functions above are defined as pure virtual functions in the
  433. top-level class `CNObject'. They are required in every derived class.
  434.  
  435.    Furthermore the following static member functions are required to
  436. allow object creation via the class description and safe type casts:
  437.  
  438. `CLASS* CLASS::cast_from_object(CNObject *obj);'
  439.      This function does a safe `(CLASS *)' type cast. It checks on type
  440.      compatibility between the object passed with the `obj' pointer and
  441.      CLASS. If this is a not true, an error message is printed and the
  442.      program terminates.
  443.  
  444.      The type checking may be disabled by defining the preprocessor
  445.      macro `NO_TYPE_CHECK', e.g. by supplying `-DNO_TYPE_CHECK' on the
  446.      compiler's command line.
  447.  
  448.      Example:
  449.  
  450.           XYZ *px;               // CNClass XYZ derived from CNObject
  451.           ABC *pa;               // CNClass ABC derived from CNObject
  452.           DEF *pd;               // CNClass DEF derived from ABC
  453.           CNObject *po;
  454.           
  455.           po = new DEF;          // Type compatible (C++ standard)
  456.           pd = (DEF *)po;        // The traditional way
  457.           pd = DEF::cast_from_object(po); // The CNCL way
  458.           
  459.           pa = new DEF;
  460.           pd = DEF::cast_from_object(pa); // o.k.
  461.           px = XYZ::cast_from_object(pa); // Error
  462.  
  463. `CNObject *CLASS::new_object(CNParam *param = NIL);'
  464.      This function creates an object of type CLASS, optionally passing a
  465.      pointer to a parameter object to the constructor.
  466.  
  467.      It is used by the class description `CNClass' to create new
  468.      objects.
  469.  
  470.    Every class in CNCL requires a class description object and a pointer
  471. constant pointing to this class description. Following the CNCL
  472. convention, the description object is named CLASS`_desc' and the
  473. pointer is named `CN_'CLASS.
  474.  
  475.    Example:
  476.  
  477.      // Describing object for class XYZ
  478.      static CNClass XYZ_desc("XYZ", "$Revision: 0.39 $", XYZ::new_object);
  479.      
  480.      // "Type" for type checking functions
  481.      CNClassDesc CN_XYZ = &XYZ_desc;
  482.  
  483. 
  484. File: cncl.info,  Node: CNgenclass,  Next: minmax,  Prev: Common Functions,  Up: Introduction
  485.  
  486. `CNgenclass' Script
  487. ===================
  488.  
  489.    To generate new classes for the CNCL hierarchy in a convenient way,
  490. the utility `CNgenclass' is provided. It generates a class framework
  491. with all the functions required by CNCL.
  492.  
  493.    Usage:
  494.  
  495.      `CNgenclass' name base
  496.  
  497.    The required parameters are the name of the class to be created and
  498. the name of the base class. The result are two files in the current
  499. directory: name`.h' (class header file) and name`.c' (class
  500. implementation file).
  501.  
  502.    Example:
  503.  
  504.      CNgenclass MyClass CNObject
  505.  
  506. creates the files `MyClass.h' and `MyClass.c'. Please note that a
  507. leading "`CN'" is removed from the file names.
  508.  
  509. 
  510. File: cncl.info,  Node: minmax,  Prev: CNgenclass,  Up: Introduction
  511.  
  512. `minmax' header file
  513. ====================
  514.  
  515.    This header file is copied from the GNU libg++ library. Its min(),
  516. max() definitions are quite useful and appear several times at CNCL. As
  517. minmax is not included with all C++ libraries, this header file is
  518. added to CNCL.
  519.  
  520.    The `inline' min() and the max() functions are declared for
  521. (un-)unsigned char, (un-)signed short, (un-)signed int, (un-)signed
  522. long, float and double.
  523.  
  524. 
  525. File: cncl.info,  Node: Basic Classes,  Next: Random Numbers,  Prev: Introduction,  Up: Top
  526.  
  527. The Basic Classes of the CNCL Hierarchy
  528. ***************************************
  529.  
  530.    The following classes constitute the basics of CNCL. They provide the
  531. framework for runtime type checking, class descriptions, object
  532. management, and error handling.
  533.  
  534. * Menu:
  535.  
  536. * CNCL::        CNCL Static Members and Functions
  537. * CNObject::        Root of the CNCL Hierarchy
  538. * CNClass::        Class Description
  539. * CNParam::        Abstract Class for Constructor Parameter Objects
  540.  
  541. 
  542. File: cncl.info,  Node: CNCL,  Next: CNObject,  Up: Basic Classes
  543.  
  544. CNCL -- CNCL Static Members and Functions
  545. =========================================
  546.  
  547. SYNOPSIS
  548. --------
  549.  
  550.    `#include <CNCL/CNCL.h>'
  551.  
  552. TYPE
  553. ----
  554.  
  555.    None
  556.  
  557. * Menu:
  558.  
  559. BASE CLASSES
  560. ------------
  561.  
  562. DERIVED CLASSES
  563. ---------------
  564. * CNObject::        Root of the CNCL Hierarchy
  565.  
  566. RELATED CLASSES
  567. ---------------
  568.  
  569. DESCRIPTION
  570. -----------
  571.  
  572.    The `CNCL' class contains only static members and functions for the
  573. class library's parameters and error handling. All classes in the CNCL
  574. hierarchy can directly access the static member functions, other code
  575. can call them via `CNCL::'func`()'.
  576.  
  577. ERROR HANDLING
  578. --------------
  579.  
  580.    The class `CNCL' provides common functionality for error handling.
  581. This is used by all classes to issue an error message or warning and
  582. terminate the program, if desired. The CNCL library also installs a
  583. `matherr()' handler using `CNCL::error()' for displaying an appropiate
  584. error message.
  585.  
  586.      enum ErrorType
  587.      {
  588.          err_fatal, err_abort, err_warning, err_ignore, err_default, err_info
  589.      };
  590.  
  591. The setting of the CNCL error handling:
  592.  
  593. `err_abort'
  594. `err_fatal'
  595.      Print error message, then terminate the program. (To do so, CNCL
  596.      calls the exit handler installed with `set_exit_handler()'.)
  597.      `err_abort' is like `err_fatal' but calls `abort()' for
  598.      termination resulting in a core dump.
  599.  
  600. `err_warning'
  601.      Print error message with "warning" prefix.
  602.  
  603. `err_ignore'
  604.      No error message.
  605.  
  606. `err_ignore'
  607.      No error, just the message for info.
  608.  
  609. `err_default'
  610.      The default setting of the CNCL error handling. The default is
  611.      `err_fatal' (may be set with `set_error()').
  612.  
  613.    The following member functions of `CNCL' can be used to manipulate
  614. the error handling.
  615.  
  616. `static ErrorType get_error();'
  617.      Returns the current error handling type.
  618.  
  619. `static ErrorType set_error(ErrorType err);'
  620.      Sets the error handling type to `err' and returns the previous
  621.      value.
  622.  
  623. `static void set_exit_handler(void (*func)());'
  624.      Installs a function to be called on fatal errors. The default
  625.      function will print a message and terminate the program by calling
  626.      `exit()' (`err_fatal') or `abort()' (`err_abort').
  627.  
  628. `static void default_exit_handler()'
  629.      The CNCL default handler called on fatal errors.
  630.  
  631. ERROR MESSAGES
  632. --------------
  633.  
  634.    The following member function can be used to output error messages
  635. and/or terminate the program. Each of the functions accepts up to six
  636. `const char *' arguments, if the first one of these is `NIL', then the
  637. default string (`"CNCL error: "', `"CNCL warning: "', `"CNCL: "' for
  638. `err_error'/`err_abort', `err_warning', `err_info', respectively) is
  639. prepended to the output.
  640.  
  641. `static void error(const char *msg1 = NIL, ...)'
  642.      Output error message, default error handling. Up to 6 different
  643.      `char *msg'`s can be added.
  644.  
  645. `void error(ErrorType err, const char *msg1 = NIL, ...)'
  646.      Output error message, error handling as specified by `err'.Up to 6
  647.      different `char *msg'`s can be added.
  648.  
  649. `static void fatal(const char *msg1 = NIL, ...)'
  650.      Output error message, fatal error handling.Up to 6 different `char
  651.      *msg'`s can be added.
  652.  
  653. `static void warning(const char *msg1 = NIL, ...)'
  654.      Output error message, warning error handling.Up to 6 different
  655.      `char *msg'`s can be added.
  656.  
  657. `static void info(const char *msg1 = NIL, ...)'
  658.      Output message.Up to 6 different `char *msg'`s can be added.
  659.  
  660. `static ostream& msg()'
  661.      Returns a reference to an output stream. Output to this stream
  662.      will be appended to the next `error()', `fatal()', `warning()',
  663.      `info()' message. This is actually a `strstream' with a maximum
  664.      capacity of `CNCL::STR_BUF_SIZE'.
  665.  
  666. UTILITIES
  667. ---------
  668.  
  669.    Outside the `CNCL' class the following constants and types are
  670. defined:
  671.  
  672. `NIL'
  673.      The null pointer defined as `0'.
  674.  
  675. `TRUE'
  676.      The boolean value true defined as `1'.
  677.  
  678. `FALSE'
  679.      The boolean value false defined as `0'.
  680.  
  681. `bool'
  682.      A boolean data type, actually `typedef int bool'.
  683.  
  684. 
  685. File: cncl.info,  Node: CNObject,  Next: CNClass,  Prev: CNCL,  Up: Basic Classes
  686.  
  687. CNObject -- Root of the CNCL Hierarchy
  688. ======================================
  689.  
  690. SYNOPSIS
  691. --------
  692.  
  693.    `#include <CNCL/Object.h>'
  694.  
  695. TYPE
  696. ----
  697.  
  698.    `CN_OBJECT'
  699.  
  700. * Menu:
  701.  
  702. BASE CLASSES
  703. ------------
  704. * CNCL::        CNCL Static Members and Functions
  705.  
  706. DERIVED CLASSES
  707. ---------------
  708. * CNClass::        Class Description
  709. * CNParam::        Abstract Class for Constructor Parameter Objects
  710. ...
  711.  
  712. RELATED CLASSES
  713. ---------------
  714. * CNClass::        Class Description
  715. * CNParam::        Abstract Class for Constructor Parameter Objects
  716.  
  717. DESCRIPTION
  718. -----------
  719.  
  720.    `CNObject' is the actual base of the CNCL inheritance tree. It must
  721. be supported by all derived classes.
  722.  
  723. `virtual CNClassDesc class_desc() const;'
  724.      Returns the class description (pointer to instance of CNClass) for
  725.      runtime type information.
  726.  
  727. `virtual bool is_a(CNClassDesc desc) const;'
  728.      Returns TRUE if the queried object is of type `desc', else FALSE.
  729.  
  730. `virtual void print(ostream &strm = cout) const = 0;'
  731.      Output object to stream.
  732.  
  733. `virtual void dump(ostream &strm = cout) const = 0;'
  734.      Output object to stream for debug purpose.
  735.  
  736. `virtual int store_on(CNPstream &);'
  737. `virtual int storer(CNPstream &);'
  738.      These functions are support functions for persistent objects, so
  739.      they are not implemented in all derived classes. They are yielding
  740.      a warning if they are called for a non-persistent object.
  741.  
  742. UTILITIES
  743. ---------
  744.  
  745.    `Object.h' defines the following operators for easily writing
  746. objects to streams:
  747.  
  748. `ostream &operator << (ostream &strm, const CNObject &obj);'
  749. `ostream &operator << (ostream &strm, const CNObject *obj);'
  750.      Write object to stream using the `print()' member function. It is
  751.      safe to output a null pointer `obj', in this case "`(NIL)'" is
  752.      printed.
  753.  
  754. 
  755. File: cncl.info,  Node: CNClass,  Next: CNParam,  Prev: CNObject,  Up: Basic Classes
  756.  
  757. CNClass -- Class Description
  758. ============================
  759.  
  760. SYNOPSIS
  761. --------
  762.  
  763.    `#include <CNCL/Class.h>'
  764.  
  765. TYPE
  766. ----
  767.  
  768.    `CN_CLASS'
  769.  
  770. * Menu:
  771.  
  772. BASE CLASSES
  773. ------------
  774. * CNObject::        Root of the CNCL Hierarchy
  775.  
  776. DERIVED CLASSES
  777. ---------------
  778.  
  779. RELATED CLASSES
  780. ---------------
  781. * CNObject::        Root of the CNCL Hierarchy
  782.  
  783. DESCRIPTION
  784. -----------
  785.  
  786.    `CNClass' is used for the type description objects. For each class in
  787. the CNCL hierarchy there is a corresponding object of type `CNClass'.
  788. A pointer to this object is used for the CNCL runtime type information.
  789.  
  790.    Constructors:
  791.  
  792. `CNClass(char *name, char *version, CNObject *(*func)(CNParam *p));'
  793.      The constructor of `CNClass' takes three arguments: the class'
  794.      name, the class' version and a pointer to the static
  795.      `CLASS::new_object()' member function of classes that provide this
  796.      functionality. The function pointer may be `NIL' for classes that
  797.      do not provide this, such as abstract base classes.
  798.  
  799.    In addition to the member functions required by CNCL, `CNClass'
  800. provides:
  801.  
  802. `const char *name() const;'
  803. `const char *get_name() const;'
  804.      Returns the class name.
  805.  
  806. `const char *version() const;'
  807. `const char *get_version() const;'
  808.      Returns the class version.
  809.  
  810. `CNObject *new_object(CNParam *param = NIL) const;'
  811. `CNObject *new_object(Param ¶m) const;'
  812.      Creates new objects via the corresponding class' static member
  813.      function `new_object()'. The `param' object is used to pass
  814.      optional arguments to the constructor.
  815.  
  816. `static CNClass *cast_from_object(CNObject *obj);'
  817.      Safes `(CNClass *)' type cast.
  818.  
  819. 
  820. File: cncl.info,  Node: CNParam,  Next: CNRNG,  Prev: CNClass,  Up: Basic Classes
  821.  
  822. CNParam -- Abstract Parameter Base Class
  823. ========================================
  824.  
  825. SYNOPSIS
  826. --------
  827.  
  828.    `#include <CNCL/Param.h>'
  829.  
  830. TYPE
  831. ----
  832.  
  833.    `CN_PARAM'
  834.  
  835. * Menu:
  836.  
  837. BASE CLASSES
  838. ------------
  839. * CNObject::        Root of the CNCL Hierarchy
  840.  
  841. DERIVED CLASSES
  842. ---------------
  843. ...
  844.  
  845. RELATED CLASSES
  846. ---------------
  847. * CNClass::        Class Description
  848.  
  849. DESCRIPTION
  850. -----------
  851.  
  852.    `CNParam' is the abstract base for parameter classes used to pass
  853. constructor parameters to objects in a general way. This will be used
  854. in the forthcoming CNCL object management.
  855.  
  856. 
  857. File: cncl.info,  Node: Random Numbers,  Next: Evaluation,  Prev: Basic Classes,  Up: Top
  858.  
  859. Random Numbers
  860. **************
  861.  
  862.    CNCL provides a variety of random number generators, ranging from the
  863. very simple linear congruence generator to more sophisticated ones. Also
  864. included is a random number generator which reads random data from a
  865. file.
  866.  
  867.    Random numbers are a crucial base of every simulation; most of the
  868. pseudo random number generators included in CNCL have their faults and
  869. short-comings.
  870.  
  871.    The base random number generators are used by the random distribution
  872. classes to generate random numbers with the desired distribution.
  873.  
  874. * Menu:
  875.  
  876. Random Number Generators
  877. ------------------------
  878.  
  879. * CNRNG::               Abstract Random Number Generator Base Class
  880. * CNACG::               Additive RNG
  881. * CNFiboG::             Fibonacci RNG
  882. * CNFileG::             Data File RNG
  883. * CNLCG::               Linear Congruence RNG
  884. * CNMLCG::              Multiple Linear Congruence RNG
  885. * CNTausG::             Tausworth RNG
  886.  
  887. Random Number Distributions
  888. ---------------------------
  889. * CNRndInt::        Random Integers
  890.  
  891. * CNRandom::            Abstract Random Distribution Base Class
  892. * CNBeta::              Beta Distribution
  893. * CNBinomial::          Binomial Distribution
  894. * CNDeterm::        Deterministic Distribution
  895. * CNDiracTab::          Distribution from Table
  896. * CNDiscUniform::       Discrete Uniform Distribution
  897. * CNErlang::            Erlang-k Distribution
  898. * CNGeometric::         Geometric Distributed Random Numbers
  899. * CNHyperExp::          HyperExp Distributed Random Numbers
  900. * CNHyperGeom::         HyperGeom Distributed Random Numbers
  901. * CNInterTab::          Distribution from Table (Interpolated Values)
  902. * CNLogNormal::         LogNormal Distribution
  903. * CNMDeterm::           Random Mix of Deterministic Distributions
  904. * CNNegExp::            Negative Exponential Distribution
  905. * CNNormal::            Normal Distribution
  906. * CNPoisson::           Poisson Distribution
  907. * CNRandomMix::         Mix of Several `CNRandom' Distributions
  908. * CNRayleigh::          Rayleigh Distribution
  909. * CNRice::              Rice Distribution
  910. * CNTab::               Distribution from Table
  911. * CNUniform::           Uniform Distribution
  912. * CNWeibull::           Weibull Distribution
  913.  
  914. 
  915. File: cncl.info,  Node: CNRNG,  Next: CNACG,  Prev: CNParam,  Up: Random Numbers
  916.  
  917. CNRNG -- Abstract Random Number Generator Base Class
  918. ====================================================
  919.  
  920. SYNOPSIS
  921. --------
  922.  
  923.    `#include <CNCL/RNG.h>'
  924.  
  925. TYPE
  926. ----
  927.  
  928.    `CN_RNG'
  929.  
  930. * Menu:
  931.  
  932. BASE CLASSES
  933. ------------
  934. * CNObject::        Root of the CNCL Hierarchy
  935.  
  936. DERIVED CLASSES
  937. ---------------
  938. * CNACG::        Additive RNG
  939. * CNFiboG::        Fibonacci RNG
  940. * CNFileG::        Data File RNG
  941. * CNLCG::        Linear Congruence RNG
  942. * CNMLCG::        Multiple Linear Congruence RNG
  943. * CNTausG::        Tausworth RNG
  944.  
  945. RELATED CLASSES
  946. ---------------
  947. * CNRandom::        Abstract Distribution Base Class
  948.  
  949. DESCRIPTION
  950. -----------
  951.  
  952.    `CNRNG' is the abstract base class for all CNCL random number
  953. generators. It defines the common interface.
  954.  
  955.    Constructors:
  956.  
  957. `CNRNG();'
  958. `CNRNG(CNParam *param);'
  959.      Initializes `CNRNG'.
  960.  
  961.    In addition to the member functions required by CNCL, `CNRNG'
  962. provides:
  963.  
  964. `unsigned long as_long();'
  965.      This function returns an unsigned integer in the range 0 ...
  966.      2^31-1. It uses the as_long32() function from the actual CNRNG to
  967.      draw a random number and truncates it down to 31bit.
  968.  
  969. `virtual unsigned long as_long32() = 0;'
  970.      This function is used to draw a random number from the actual CNRNG
  971.      (derived from the `CNRNG' class). The result is an unsigned integer
  972.      in the range 0 ... 2^32-1 provided the class is able to produce
  973.      32bit random numbers.
  974.  
  975. `virtual bool has_long32() = 0;'
  976.      This function tells whether the actual CNRNG is able to produce
  977.      32bit integer values or not.
  978.  
  979. `virtual void reset() = 0;'
  980.      Resets the CNRNG to its initial state.
  981.  
  982. `float as_float();'
  983. `double as_double();'
  984.      These functions draw a random number in the range 0 ... 1 and
  985.      return the result as a `float' or `double' value.
  986.  
  987. `virtual void seed(unsigned long s);'
  988.      This method for all RNG's only draws `s' as_long32() numbers.
  989.  
  990. 
  991. File: cncl.info,  Node: CNACG,  Next: CNFiboG,  Prev: CNRNG,  Up: Random Numbers
  992.  
  993. CNACG -- Additive RNG
  994. =====================
  995.  
  996. SYNOPSIS
  997. --------
  998.  
  999.    `#include <CNCL/ACG.h>'
  1000.  
  1001. TYPE
  1002. ----
  1003.  
  1004.    `CN_ACG'
  1005.  
  1006. * Menu:
  1007.  
  1008. BASE CLASSES
  1009. ------------
  1010. * CNRNG::        Abstract Random Number Generator Base Class
  1011.  
  1012. DERIVED CLASSES
  1013. ---------------
  1014.  
  1015. RELATED CLASSES
  1016. ---------------
  1017. * CNRandom::        Abstract Distribution Base Class
  1018.  
  1019. DESCRIPTION
  1020. -----------
  1021.  
  1022.    `CNACG' is the additive random number generator class. This class has
  1023. extremly long period lengths and provides a good independence.
  1024. Unfortunately, uniformity is not too great.
  1025. NOTE: More information about this method you can find at:
  1026. Knuth, Donald E.;The Art Of Computer Programming, Volume II; Reading,
  1027. Massachusetts; Addison-Wesley; page 26/27
  1028.  
  1029.    Constructors:
  1030.  
  1031. `CNACG(unsigned long seed = 0, int size = 55);'
  1032. `CNACG(CNParam *param);'
  1033.      Initializes `CNACG'.
  1034.  
  1035.    In addition to the member functions required by CNCL, `CNACG'
  1036. provides:
  1037.  
  1038. `virtual unsigned long as_long32();'
  1039.      Draws a random number.  The result is an unsigned integer in the
  1040.      range 0 ... 2^32-1.
  1041.  
  1042. `virtual bool has_long32();'
  1043.      Returns TRUE because the CNACG is able to produce 32bit integer
  1044.      values.
  1045.  
  1046. `virtual void reset();'
  1047.      Resets the CNACG to its initial state.
  1048.  
  1049. 
  1050. File: cncl.info,  Node: CNFiboG,  Next: CNFileG,  Prev: CNACG,  Up: Random Numbers
  1051.  
  1052. CNFiboG -- Fibonacci RNG
  1053. ========================
  1054.  
  1055. SYNOPSIS
  1056. --------
  1057.  
  1058.    `#include <CNCL/FiboG.h>'
  1059.  
  1060. TYPE
  1061. ----
  1062.  
  1063.    `CN_FIBOG'
  1064.  
  1065. * Menu:
  1066.  
  1067. BASE CLASSES
  1068. ------------
  1069. * CNRNG::            Abstract Random Number Generator Base Class
  1070.  
  1071. DERIVED CLASSES
  1072. ---------------
  1073.  
  1074. RELATED CLASSES
  1075. ---------------
  1076. * CNRandom::        Abstract Distribution Base Class
  1077.  
  1078. DESCRIPTION
  1079. -----------
  1080.  
  1081.    `CNFiboG' is the Fibonacci random number generator class.
  1082.  
  1083.    The main advantage of this method can be seen in a combination of a
  1084. simple mathematical formula and a period length sufficient enough for
  1085. physical simulation runs. Nevertheless, it still represents a pseudo
  1086. random number generator. Thus a non-ideal correlation can be expected.
  1087.  
  1088.    Constructors:
  1089.  
  1090. `CNFiboG(CNParam *param);'
  1091. `CNFiboG(unsigned long init = 54217137);'
  1092.      Initializes `CNFiboG' with a 97 elements circular queue and initial
  1093.      seed.
  1094.  
  1095.    In addition to the member functions required by CNCL, `CNFiboG'
  1096. provides:
  1097.  
  1098. `virtual unsigned long as_long32();'
  1099.      Draws a random number.  The result is an unsigned integer in the
  1100.      range 0 ... 2^32-1.
  1101.  
  1102. `virtual bool has_long32();'
  1103.      Returns TRUE because CNFiboG is able to produce 32bit integer
  1104.      values.
  1105.  
  1106. `virtual void reset();'
  1107.      Resets the CNFiboG to its initial state.
  1108.  
  1109. `void seed_internal(unsigned long *ulp);'
  1110.      Reinitializes the circular queue and cn with `*ulp', an array of
  1111.      98 values.
  1112.  
  1113. 
  1114. File: cncl.info,  Node: CNFileG,  Next: CNLCG,  Prev: CNFiboG,  Up: Random Numbers
  1115.  
  1116. CNFileG -- Data File RNG
  1117. ========================
  1118.  
  1119. SYNOPSIS
  1120. --------
  1121.  
  1122.    `#include <CNCL/FileG.h>'
  1123.  
  1124. TYPE
  1125. ----
  1126.  
  1127.    `CN_FILEG'
  1128.  
  1129. * Menu:
  1130.  
  1131. BASE CLASSES
  1132. ------------
  1133. * CNRNG::            Abstract Random Number Generator Base Class
  1134.  
  1135. DERIVED CLASSES
  1136. ---------------
  1137.  
  1138. RELATED CLASSES
  1139. ---------------
  1140. * CNRandom::        Abstract Distribution Base Class
  1141.  
  1142. DESCRIPTION
  1143. -----------
  1144.  
  1145.    `CNFileG' is a data file random number generator class. It reads
  1146. random numbers from a disk file, e.g. data from PURAN2. Thus the quality
  1147. of this generator class depends on the quality of the data files. Truely
  1148. random numbers can be generated if a good file is supplied. Here the
  1149. problem of this class can be seen. A good file must have a sufficient
  1150. size. Huge memory use and low speed can be expected when using this
  1151. class.
  1152.  
  1153.    Constructors:
  1154.  
  1155. `CNFileG(char *filename, bool par = FALSE);'
  1156. `CNFileG(CNParam *param);'
  1157.      Initializes `CNFileG' with data file `filename' and sets parity
  1158.      check if required, e.g. parity check for PURAN2.
  1159.  
  1160.    In addition to the member functions required by CNCL, `CNFileG'
  1161. provides:
  1162.  
  1163. `virtual unsigned long as_long32();'
  1164.      Draws a random number.  The result is an unsigned integer in the
  1165.      range 0 ... 2^32-1.
  1166.  
  1167. `virtual bool has_long32();'
  1168.      Returns TRUE because the CNFileG is able to produce 32bit integer
  1169.      values.
  1170.  
  1171. `virtual void reset();'
  1172.      Resets the CNFileG to its initial state.
  1173.  
  1174. `void newfile(char *filename, bool par = FALSE);'
  1175.      Opens a new file for reading random number data and indicates if
  1176.      data requires parity check.
  1177.  
  1178. `unsigned int wrong_parity();'
  1179.      Gets the number of wrong parity checks while reading data from a
  1180.      file, e.g. data from PURAN2.
  1181.  
  1182. 
  1183. File: cncl.info,  Node: CNLCG,  Next: CNMLCG,  Prev: CNFileG,  Up: Random Numbers
  1184.  
  1185. CNLCG --  Linear Congruence RNG
  1186. ===============================
  1187.  
  1188. SYNOPSIS
  1189. --------
  1190.  
  1191.    `#include <CNCL/LCG.h>'
  1192.  
  1193. TYPE
  1194. ----
  1195.  
  1196.    `CN_LCG'
  1197.  
  1198. * Menu:
  1199.  
  1200. BASE CLASSES
  1201. ------------
  1202. * CNRNG::            Abstract Random Number Generator Base Class
  1203.  
  1204. DERIVED CLASSES
  1205. ---------------
  1206.  
  1207. RELATED CLASSES
  1208. ---------------
  1209. * CNRandom::        Abstract Distribution Base Class
  1210.  
  1211. DESCRIPTION
  1212. -----------
  1213.  
  1214.    `CNLCG' is a linear congruence random number generator class.
  1215.  
  1216.    This class is using the easiest method for pseudo random number
  1217. generator. It is the fastest one, but its short-comings should not be
  1218. neglected. The period is very short, usually not sufficient for any
  1219. serious simulation. Depending on the chosen seed value only even or odd
  1220. numbers are drawn. Any period of drawn numbers are highly correlated.
  1221. Thus this class should not be used at any important simulation.
  1222.  
  1223.    Constructors:
  1224.  
  1225. `CNLCG(unsigned long seed = 929);'
  1226. `CNLCG(CNParam *param);'
  1227.      Initializes `CNLCG' with initial `seed'.
  1228.  
  1229.    In addition to the member functions required by CNCL, `CNLCG'
  1230. provides:
  1231.  
  1232. `virtual unsigned long as_long32();'
  1233.      Draws a random number.  The result is an unsigned integer in the
  1234.      range 0 ... 2^31-1.
  1235.  
  1236. `virtual bool has_long32();'
  1237.      Returns FALSE because LCG produces only 31bit integer values.
  1238.  
  1239. `virtual void reset();'
  1240.      Resets the CNLCG to its initial state.
  1241.  
  1242. `void seed(unsigned long);'
  1243.      Sets the CNLCG seed value.
  1244.  
  1245. 
  1246. File: cncl.info,  Node: CNMLCG,  Next: CNTausG,  Prev: CNLCG,  Up: Random Numbers
  1247.  
  1248. CNMLCG -- Multiple Linear Congruence RNG
  1249. ========================================
  1250.  
  1251. SYNOPSIS
  1252. --------
  1253.  
  1254.    `#include <CNCL/MLCG.h>'
  1255.  
  1256. TYPE
  1257. ----
  1258.  
  1259.    `CN_CNMLCG'
  1260.  
  1261. * Menu:
  1262.  
  1263. BASE CLASSES
  1264. ------------
  1265. * CNRNG::            Abstract Random Number Generator Base Class
  1266.  
  1267. DERIVED CLASSES
  1268. ---------------
  1269.  
  1270. RELATED CLASSES
  1271. ---------------
  1272. * CNRandom::        Abstract Distribution Base Class
  1273.  
  1274. DESCRIPTION
  1275. -----------
  1276.  
  1277.    `CNMLCG' is a multiple linear congruence random number generator
  1278. class combining the results of two different CNLCGs.
  1279.  
  1280.    Constructors:
  1281.  
  1282. `CNMLCG();'
  1283. `CNMLCG(long seed1, long seed2);'
  1284. `CNMLCG(CNParam *param);'
  1285.      Initializes `CNMLCG' with two seeds, `seed1' and `seed2'. The
  1286.      default constructor sets both seeds to 0.
  1287.  
  1288.    In addition to the member functions required by CNCL, `CNMLCG'
  1289. provides:
  1290.  
  1291. `virtual unsigned long as_long32();'
  1292.      Draws a random number.  The result is an unsigned integer in the
  1293.      range 0 ... 2^31-1.
  1294.  
  1295. `virtual bool has_long32();'
  1296.      Returns FALSE because CNMLCG produces only 31bit intger values.
  1297.  
  1298. `virtual void reset();'
  1299.      Resets the CNMLCG to its initial state.
  1300.  
  1301. `void  seed(unsigned long s);'
  1302.      Sets the two seed values, the first one to `s' and the second one
  1303.      to `s + 2147483561'.
  1304.  
  1305. `void  seed_internal(unsigned long, unsigned long);'
  1306.      Sets both seed values.
  1307.  
  1308. 
  1309. File: cncl.info,  Node: CNTausG,  Next: CNRndInt,  Prev: CNMLCG,  Up: Random Numbers
  1310.  
  1311. CNTausG --  Tausworth RNG
  1312. =========================
  1313.  
  1314. SYNOPSIS
  1315. --------
  1316.  
  1317.    `#include <CNCL/TausG.h>'
  1318.  
  1319. TYPE
  1320. ----
  1321.  
  1322.    `CN_TAUSG'
  1323.  
  1324. * Menu:
  1325.  
  1326. BASE CLASSES
  1327. ------------
  1328. * CNRNG::        Abstract Random Number Generator Base Class
  1329.  
  1330. DERIVED CLASSES
  1331. ---------------
  1332.  
  1333. RELATED CLASSES
  1334. ---------------
  1335. * CNRandom::        Abstract Distribution Base Class
  1336.  
  1337. DESCRIPTION
  1338. -----------
  1339.  
  1340.    `CNTausG' is a Tausworth random number generator class.
  1341.  
  1342.    This generator is a special form of the Fibonacci generator. The
  1343. period length is reduced, but the mathematical formula is easier. It
  1344. even can be implemented as a hardware shift register.  Binomial
  1345. Distribution Constructors:
  1346.  
  1347. `CNTausG();'
  1348. `CNTausG(CNParam *param);'
  1349.      Initializes `CNTausG'.
  1350.  
  1351.    In addition to the member functions required by CNCL, `CNTausG'
  1352. provides:
  1353.  
  1354. `virtual unsigned long as_long32();'
  1355.      Draws a random number.  The result is an unsigned integer in the
  1356.      range 0 ... 2^32-1.
  1357.  
  1358. `virtual bool has_long32();'
  1359.      Returns TRUE because CNTausG is able to produce 32bit integer
  1360.      values.
  1361.  
  1362. `virtual void reset();'
  1363.      Resets the CNTausG to its initial state.
  1364.  
  1365. 
  1366. File: cncl.info,  Node: CNRndInt,  Next: CNRandom,  Prev: CNTausG,  Up: Random Numbers
  1367.  
  1368. CNRndInt -- Random Integers
  1369. ===========================
  1370.  
  1371. SYNOPSIS
  1372. --------
  1373.  
  1374.    `#include <CNCL/RndInt.h>'
  1375.  
  1376. TYPE
  1377. ----
  1378.  
  1379.    `CN_RNDINT'
  1380.  
  1381. * Menu:
  1382.  
  1383. BASE CLASSES
  1384. ------------
  1385. * CNObject::        Root of the CNCL Hierarchy
  1386.  
  1387. DERIVED CLASSES
  1388. ---------------
  1389.  
  1390. RELATED CLASSES
  1391. ---------------
  1392. * CNRNG::        Abstract Random Number Generator Base Class
  1393.  
  1394. DESCRIPTION
  1395. -----------
  1396.  
  1397.    `CNRndInt' generates uniform distributed random integers in a given
  1398. interval. The result is the same as provided by the `CNDiscUniform'
  1399. distribution, but `CNRndInt' is more efficient.
  1400.  
  1401.    BEWARE: do NOT use the `CNLCG' RNG as a base generator for
  1402. `CNRndInt'.
  1403.  
  1404.    Constructors:
  1405.  
  1406. `CNRndInt();'
  1407. `CNRndInt(CNParam *param);'
  1408. `CNRndInt(long low, long high, CNRNG *gen);'
  1409. `CNRndInt(long high, CNRNG *gen);'
  1410. `CNRndInt(CNRNG *gen);'
  1411.      Initializes a `CNRndInt' with base RNG `gen' and upper/lower
  1412.      interval limits `low'/`high'.
  1413.  
  1414.    In addition to the member functions required by CNCL, `CNRndInt'
  1415. provides:
  1416.  
  1417. `CNRNG *generator() const;'
  1418. `CNRNG *generator(CNRNG *gen);'
  1419.      Gets/sets the base CNRNG used by `CNRndInt'.
  1420.  
  1421. `long low() const;'
  1422. `long high() const;'
  1423. `long low(long x);'
  1424. `long high(long x);'
  1425.      Gets/sets the upper/lower interval limits.
  1426.  
  1427. `long operator()();'
  1428. `long operator()(long high);'
  1429. `long operator()(long low, long high);'
  1430. `long as_long();'
  1431. `long as_long(long high);'
  1432. `long as_long(long low, long high);'
  1433.      Draws a `long' random integer. Interval limits may be passed as
  1434.      optional parameters.
  1435.  
  1436. `int as_int();'
  1437. `int as_int(long high);'
  1438. `int as_int(long low, long high);'
  1439.      Draws a `int' random integer. Interval limits may be passed as
  1440.      optional parameters.
  1441.  
  1442. 
  1443. File: cncl.info,  Node: CNRandom,  Next: CNBeta,  Prev: CNRndInt,  Up: Random Numbers
  1444.  
  1445. CNRandom -- Abstract Random Distribution Base Class
  1446. ===================================================
  1447.  
  1448. SYNOPSIS
  1449. --------
  1450.  
  1451.    `#include <CNCL/Random.h>'
  1452.  
  1453. TYPE
  1454. ----
  1455.  
  1456.    `CN_RANDOM'
  1457.  
  1458. * Menu:
  1459.  
  1460. BASE CLASSES
  1461. ------------
  1462. * CNObject::        Root of the CNCL Hierarchy
  1463.  
  1464. DERIVED CLASSES
  1465. ---------------
  1466. * CNRandom::            Abstract Random Distribution Base Class
  1467. * CNBeta::              Beta Distribution
  1468. * CNBinomial::          Binomial Distribution
  1469. * CNDeterm::        Deterministic Distribution
  1470. * CNDiracTab::          Distribution from Table
  1471. * CNDiscUniform::       Discrete Uniform Distribution
  1472. * CNErlang::            Erlang-k Distribution
  1473. * CNGeometric::         Geometric Distributed Random Numbers
  1474. * CNHyperExp::          HyperExp Distributed Random Numbers
  1475. * CNHyperGeom::         HyperGeom Distributed Random Numbers
  1476. * CNInterTab::          Distribution from Table (Interpolated Values)
  1477. * CNLogNormal::         LogNormal Distribution
  1478. * CNMDeterm::           Random Mix of Deterministic Distributions
  1479. * CNNegExp::            Negative Exponential Distribution
  1480. * CNNormal::            Normal Distribution
  1481. * CNPoisson::           Poisson Distribution
  1482. * CNRandomMix::         Mix of Several `CNRandom' Distributions
  1483. * CNRayleigh::          Rayleigh Distribution
  1484. * CNRice::              Rice Distribution
  1485. * CNTab::               Distribution from Table
  1486. * CNUniform::           Uniform Distribution
  1487. * CNWeibull::           Weibull Distribution
  1488.  
  1489. RELATED CLASSES
  1490. ---------------
  1491. * CNRNG::        Abstract Random Number Generator Base Class
  1492.  
  1493. DESCRIPTION
  1494. -----------
  1495.  
  1496.    `CNRandom' is the abstract base class for all CNCL random number
  1497. distributions. It defines a common interface to access to all derived
  1498. RNG classes in a common way.
  1499.  
  1500.    Constructors:
  1501.  
  1502. `CNRandom(CNRNG *gen);'
  1503. `CNRandom(CNParam *param);'
  1504.      Initializes `CNRandom' with a base random number generator.
  1505.  
  1506.    In addition to the member functions required by CNCL, `CNRandom'
  1507. provides:
  1508.  
  1509. `CNRNG *generator();'
  1510.      Returns a pointer to the actually used CNRNG.
  1511.  
  1512. `void generator(CNRNG *gen);'
  1513.      Sets the CNRNG used by `CNRandom' to `gen'.
  1514.  
  1515. `virtual double operator() () = 0;'
  1516. `double draw();'
  1517.      Draws a random number from the distribution. The operator `()'
  1518.      must be defined in the derived classes.
  1519.  
  1520. 
  1521. File: cncl.info,  Node: CNBeta,  Next: CNBinomial,  Prev: CNRandom,  Up: Random Numbers
  1522.  
  1523. CNBeta -- Beta Distribution
  1524. ===========================
  1525.  
  1526. SYNOPSIS
  1527. --------
  1528.  
  1529.    `#include <CNCL/Beta.h>'
  1530.  
  1531. TYPE
  1532. ----
  1533.  
  1534.    `CN_BETA'
  1535.  
  1536. * Menu:
  1537.  
  1538. BASE CLASSES
  1539. ------------
  1540. * CNRandom::        Abstract Random Distribution Base Class
  1541.  
  1542. DERIVED CLASSES
  1543. ---------------
  1544.  
  1545. RELATED CLASSES
  1546. ---------------
  1547. * CNRNG::        Abstract Random Number Generator Base Class
  1548.  
  1549. DESCRIPTION
  1550. -----------
  1551.  
  1552.    `CNBeta' is a class for generating beta distributed random numbers.
  1553.  
  1554.    Constructors:
  1555.  
  1556. `CNBeta();'
  1557. `CNBeta(CNParam *param);'
  1558. `CNBeta(long a, long b, CNRNG *gen);'
  1559.      Initializes a `CNBeta' distribution with a base random number
  1560.      generator `gen' and the parameters `a' and `b'.
  1561.  
  1562.    In addition to the member functions required by CNCL, `CNBeta'
  1563. provides:
  1564.  
  1565. `virtual double operator() ();'
  1566.      Draws a beta distributed random number.
  1567.  
  1568. 
  1569. File: cncl.info,  Node: CNBinomial,  Next: CNDeterm,  Prev: CNBeta,  Up: Random Numbers
  1570.  
  1571. CNBinomial -- Binomial Distribution
  1572. ===================================
  1573.  
  1574. SYNOPSIS
  1575. --------
  1576.  
  1577.    `#include <CNCL/Binomial.h>'
  1578.  
  1579. TYPE
  1580. ----
  1581.  
  1582.    `CN_BINOMIAL'
  1583.  
  1584. * Menu:
  1585.  
  1586. BASE CLASSES
  1587. ------------
  1588. * CNRandom::        Abstract Random Distribution Base Class
  1589.  
  1590. DERIVED CLASSES
  1591. ---------------
  1592.  
  1593. RELATED CLASSES
  1594. ---------------
  1595. * CNRNG::        Abstract Random Number Generator Base Class
  1596.  
  1597. DESCRIPTION
  1598. -----------
  1599.  
  1600.    `CNBinomial' is a class for generating binomial distributed random
  1601. numbers.
  1602.  
  1603.    Constructors:
  1604.  
  1605. `CNBinomial();'
  1606. `CNBinomial(CNParam *param);'
  1607. `CNBinomial(int n, double u, CNRNG *gen);'
  1608.      Initializes a `CNBinomial' distribution with a base random number
  1609.      generator `gen', and the parameters `n' and `u'.
  1610.  
  1611.    In addition to the member functions required by CNCL, `CNBinomial'
  1612. provides:
  1613.  
  1614. `int n();'
  1615. `int n(int xn);'
  1616. `double u();'
  1617. `double u(double xu);'
  1618.      Gets/sets the values for n and u.
  1619.  
  1620. `virtual double operator() ();'
  1621.      Draws a binomial distributed random number.
  1622.  
  1623. 
  1624. File: cncl.info,  Node: CNDeterm,  Next: CNDiracTab,  Prev: CNBinomial,  Up: Random Numbers
  1625.  
  1626. CNDeterm -- Deterministic Distribution
  1627. ======================================
  1628.  
  1629. SYNOPSIS
  1630. --------
  1631.  
  1632.    `#include <CNCL/Determ.h>'
  1633.  
  1634. TYPE
  1635. ----
  1636.  
  1637.    `CN_DETERM'
  1638.  
  1639. * Menu:
  1640.  
  1641. BASE CLASSES
  1642. ------------
  1643. * CNRandom::        Abstract Random Distribution Base Class
  1644.  
  1645. DERIVED CLASSES
  1646. ---------------
  1647.  
  1648. RELATED CLASSES
  1649. ---------------
  1650. * CNRNG::        Abstract Random Number Generator Base Class
  1651.  
  1652. DESCRIPTION
  1653. -----------
  1654.  
  1655.    `CNDeterm' is a class for generating deterministic "random" numbers,
  1656. i.e. it always generates the same value. This is useful for mixed
  1657. distributions.
  1658.  
  1659.    Constructors:
  1660.  
  1661. `CNDeterm();'
  1662. `CNDeterm(CNParam *param);'
  1663. `CNDeterm(double value, CNRNG *gen);'
  1664.      Initializes a `CNDeterm' distribution with `value'.
  1665.  
  1666.    In addition to the member functions required by CNCL, `CNDeterm'
  1667. provides:
  1668.  
  1669. `double value();'
  1670. `double mean();'
  1671. `double value(double x);'
  1672. `double mean(double x);'
  1673.      Gets/sets the deterministic value.
  1674.  
  1675. `virtual double operator() ();'
  1676.      Draws a deterministic (i.e. not random) number.
  1677.  
  1678.